
package general.semantics;

import general.art.Cluster;
import general.art.Node;
import general.database.SQLiteInterface;
import general.exceptions.NodeNotFoundException;

import java.sql.SQLException;
import java.util.LinkedList;


/**
 * This class does all of the communication between both ART and the DB. The front end should only use this
 * search class to get any of the required functionalities and 
 * 
 * @author Hood, Lance
 *
 */
public class Search {

    /** String to print in the current seed node searched in Art.   */
    protected static String sFinishPopulatingTxt = "Finished population";

    /** String to print in the current seed node searched in Art.   */
    protected String mAvilabelNodes = "available nodes: ";

    /** String to print in the current seed node searched in Art.  */
    protected String mPrintSeedNode;


    /** An ArtAccessor instance to populate ART and seek results from it. */ 
    private ArtAccessor mArtAccess;

    /**
     * This method  populates ART with all of the links for a particular seeding node.
     * 
     * @param seedingNodes   List of seeding nodes' keys.
     * @param weights       List of seeding nodes' weights.
     */
    public void preformQuery(final Cluster c){

        double weight;
        Node node;

       // mArtAccess = new ArtAccessor();

        /*for (int i= 0; i < seedingNodes.size(); i++){


            weight = weights.get(i);
            node = seedingNodes.get(i);

            assert weight >= 0 && weight <= 1; 

            mPrintSeedNode = ".......................  " + node.getName() + "  ......................";

            System.out.println(mPrintSeedNode);

            // populate ART with all links for the current seeding node.*/
           // mArtAccess.populateArt(c);
/*
            System.out.println(sFinishPopulatingTxt);
        }*/

        /* Instruct art to now seek */
        mArtAccess.seekOnArt();

    }

    /**
     * 
     * @return Node     Next node in the result
     * @throws NodeNotFoundExceptionTest 
     */
    public Node nextResult() throws NodeNotFoundException{

        return mArtAccess.getNextRes();
        
    }

}
